package com.ljc.dao;

import com.ljc.entity.DeviceUtilization;
import com.ljc.vo.DeviceUtilizationSearch;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface DeviceUtilizationDao {
@Insert("insert into device_utilization(college_name,annual," +
        "device_name,device_number," +
        "device_quantity,device_price," +
        "purchase_year,available_hour," +
        "rated_hour,utilization," +
        "user_id)" +
        "values(#{collegeName},#{annual}," +
        "#{deviceName},#{deviceNumber}," +
        "#{deviceQuantity}," + "#{devicePrice}," +
        "#{purchaseYear},#{availableHour}," +
        "#{ratedHour},#{utilization}," +
        "#{userId})")
    void add(DeviceUtilization deviceUtilization);


    List<DeviceUtilization> searchByUser(DeviceUtilizationSearch search);

    @Select("select * from device_utilization where id=#{id}")
    DeviceUtilization getOne(int id);

    void update(DeviceUtilization deviceUtilization);

    @Delete("delete from device_utilization where id =#{id}")
    void delete(int id);

    List<DeviceUtilization> searchByAdmit(DeviceUtilizationSearch search);
}
